<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"
    import="com.sds.shop.vo.*, java.sql.*, com.sds.fw.util.*, com.sds.fw.mvc.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<%
try{
	System.out.println("aaa");
	
	SessionVO svo = (SessionVO)session.getAttribute("user");
	
	String mem_id = svo.getMemId();
	String title = (String)request.getAttribute("title");
	System.out.println(title);
	String text = (String)request.getAttribute("text");
	System.out.println(text);
	
	Connection conn = null;
	PreparedStatement ps = null;
	ResultSet rs = null;

	conn = DBUtil.getConnection();
	ps = conn.prepareStatement("select max(board_no) from tb_board");
	rs = ps.executeQuery();
	
	int board_no = 1;
	if(rs.next()) board_no = rs.getInt(1);
	
	String sql = "insert into tb_board values(?,?,?,?,?,?,sysdate,'')";		
	ps = conn.prepareStatement(sql); 
	ps.setInt(1, board_no+1);
	ps.setString(2, svo.getMemId());
	ps.setString(3, title);
	ps.setString(4, text);
	ps.setInt(5, 0);
	ps.setBoolean(6, false);
	ps.executeUpdate();
	
	rs.close();
	ps.close();
	conn.close();
	
	HttpUtil.forward(request, response, "/shop/board.do");
}
catch(Exception ex){
	System.out.println("getGoods exception : " + ex);
}


%>
</body>
</html>